<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$eventTable = new BAEventSheet();
$event = $eventTable->getListById($eventId);
$pollItemTable = new BWWePollSheet('wePollItem', $event);

$pollItemView = $pollItemTable->getView();


?>
<table class="table table-hover">
    <thead>
        <tr>
            <th><input type="checkbox" name="checkAll_2" id="checkAll_2"></th>
            <th>投票问题</th>
            <th>可选数量</th>
            <th>操作</th>
        </tr> 
    </thead>
    <tbody>
        <?php foreach ($pollItemView as $pollId => $poll) { 
            $pollOptionTable = new BWWePollSheet('wePollOption',$poll);
            $optionCount = $pollOptionTable->getCount();
            ?>
            <tr>
                <td><label class="checkbox">
                        <input type="checkbox" name="subBox[]" value="<?php echo $poll->id; ?>"> 
                    </label></td>
                <td> <?php echo $poll->getItem('question')->getValue(); ?> </td>              
                <td> <?php echo $optionCount; ?> </td>
                <td>
                    <div class="row-fluid">
                        <?php
                        echo $control->getAjaxLink(array('name' => '修改', 'id' => 'showAddWePollItem'), array(
                            'cooker'=>'BWeEventWePollCooker\showAddWePollItem',
                            'pollId' => $pollId, 
                            'pollItemId'=>$pollItemId,
                            'eventId' => $eventId));                        
                        ?>
                    </div>                   
                </td>
            </tr>
        <?php } ?>
    </tbody>
</table>
<?php
echo $control->getAjaxLink(array('name' => '添加问题', 'id' => 'showAddWePollItem'), array(
    'cooker' => 'BWeEventWePoll\showAddWePollItem',
    'eventId' => $eventId,
    'pollId' => $pollItemId,
    'pollItemId'=>0,
    'htmlOptions' => array('class' => 'btn')
));
?>
